package org.zn.etl.misc;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;

import org.zn.datax.common.entity.TableInfo;
import org.zn.etl.job.entity.DataMapping;

public class EtlTablesDataMapping {
	
	public static List<DataMapping> loadTables() throws IOException {
			
		FileReader fr=new FileReader("D:\\tablePairs.txt");
		
		BufferedReader br=new BufferedReader(fr);
		
		List<DataMapping> dmlist=br.lines().map((it)->{
			
			System.out.println(it);
			
			String[] tb=it.split(",");
			
			DataMapping dm=new DataMapping();
			
			dm.setSourceTable(new TableInfo(tb[0]));
			dm.setTargetTable(new TableInfo(tb[1]));

			return dm;	
		}).collect(Collectors.toList());
		
		br.close();
		
		return dmlist;
		
		
	}
	
	

}
